/*
ID:luongho3
LANG:C++
TASK:fracdec
*/
#include <iostream>
#include <fstream>

using namespace std;
ifstream fin("fracdec.in");
ofstream fout("fracdec.out");
#define MAXDIGIT 200000
#define DEC_POINT -1
#define O_PAREN -2
#define C_PAREN -3
#define LINE_LENGTH 76
#define MARK_REM 1
int N,D,idx,c_c;
int digit[MAXDIGIT], rem[MAXDIGIT], pos[MAXDIGIT];

void extract() {
     int tmp = N/D;
     N %= D;
     int t_array[MAXDIGIT],j,k;
     j = 0;
     while (tmp > 0) {
           t_array[j] = tmp % 10;
           tmp /= 10;
           ++j;
     }
     for (k=j-1;k>=0;--k) {
         digit[idx] = t_array[k];
         ++idx;
     }
     digit[idx] = DEC_POINT;
     ++idx;
}

void print_digit(int code) {
     if (code == DEC_POINT) {
        fout << ".";
     }
     else if (code == O_PAREN) {
          fout << "(";    
     }
     else if (code == C_PAREN) {
          fout << ")";
     }
     else {
          fout << code;
     }
     ++c_c;
     if (c_c == LINE_LENGTH) {
        fout << "\n";
        c_c = 0;
     }
}
int main() {
    fin >> N >> D;
    idx = 1;
    if (N >= D) {
          extract();
          rem[N%D] = MARK_REM;
          pos[N%D] = idx - 1;
    }
    else {
         digit[1] = 0;
         digit[2] = DEC_POINT;
         rem[N%D] = MARK_REM;
         pos[N%D] = 2;
         idx = 3;
    }
    while (N > 0) {
         N *= 10;
         digit[idx] = N / D;
         ++idx;
         if (rem[N%D] != MARK_REM) {
            rem[N%D] = MARK_REM;
            pos[N%D] = idx - 1;
            N %= D;
         }
         else {
              break;
         }
    }
    c_c = 0;
    if (N == 0) {
          //no repeat
          int i;
          for (i=1;i<idx;++i) {
              print_digit(digit[i]);
          }
          if (digit[idx-1] == DEC_POINT) {
             print_digit(0);                 
          }
    }
    else {
         //repeat
         int i;
         for (i=1;i<=pos[N%D];++i) {
             print_digit(digit[i]);
         }
         print_digit(O_PAREN);
         for (;i<idx;++i) {
             print_digit(digit[i]);
         }
         print_digit(C_PAREN);
    }
    fout << "\n";
    return 0;
}
